package appconfig

import (
	"github.com/spf13/viper"
	"log"
)

type AppConfig struct {
	Mysql
	Redis
	SendSms
	QiNiuYun
}
type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}
type Redis struct {
	Host     string
	Port     int
	Password string
}
type SendSms struct {
	AccessKeyId     string
	AccessKeySecret string
	Endpoint        string
}
type QiNiuYun struct {
	AccessKey string
	SecretKey string
	Bucket    string
	Url       string
}

var Appconf AppConfig

func Init() {
	viper.SetConfigFile("../appconfig/dev.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&Appconf)
	log.Println("动态配置数据文件成功")
}
